package cn.tedu.oa.reimbursement.controller;

import cn.tedu.oa.base.response.JsonResult;
import cn.tedu.oa.reimbursement.pojo.dto.ReimbursementQuery;
import cn.tedu.oa.reimbursement.pojo.dto.ReimbursementSaveParam;
import cn.tedu.oa.reimbursement.pojo.vo.ReimbursementVO;
import cn.tedu.oa.reimbursement.service.ReimbursementService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/oa1/reimbursement")
@Slf4j
public class ReimbursementController {
    @Autowired
    ReimbursementService reimbursementService;
    @GetMapping ("/select")
    public JsonResult select(ReimbursementQuery reimbursementQuery){
        log.debug("查询报销单"+reimbursementQuery);
        List<ReimbursementVO> list = reimbursementService.select( reimbursementQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("/save")
    public JsonResult save(ReimbursementSaveParam reimbursementtSaveParam){
        log.debug("保存报销单"+reimbursementtSaveParam);
        reimbursementService.save(reimbursementtSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("/delete/{id}")
    public JsonResult delete(@PathVariable  Integer id){
        log.debug("删除报销单"+id);
        reimbursementService.delete(id);
        return JsonResult.ok();
    }
}
